package com.gxa.controller;


import com.gxa.common.R;
import com.gxa.pojo.Params_Son;
import com.gxa.pojo.Resume;
import com.gxa.utils.DateUtils;
import io.swagger.annotations.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Controller
@Api(value = "人才库储存接口",tags = "人才库储存接口API")
@RequestMapping(value = "/TalentSave/*")
public class TalentSaveController {
    /**
     * 查找单个人才信息接口
     * @param resume_id
     * @return
     */
    @RequestMapping(value = "/queryTalentInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查找单个人才信息接口",notes = "查找",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })

    public R queryTalentInfo(@RequestParam(name="resume_id") Integer resume_id){
        R r = new R();
        r.setMsg("查询成功！");
        r.setCode(200);
        List<Object> list = new ArrayList<>();
        Params_Son params_son = new Params_Son();
        params_son.setParam_id(2);
        params_son.setParam_value("本科");
        Resume resume = new Resume();
        resume.setResume_id(resume_id);
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        String Re_birthday = "1991-01-01";
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(1);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
        list.add(resume);
        list.add(params_son);
        r.setData(list);
        return r;
    }

    /**
     *查询所有人才信息接口
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/showTalentInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询所有人才信息接口",notes = "查询全部信息",httpMethod = "GET", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码值",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示的条数",paramType = "query",dataType = "String",required = true)
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showTalentInfo(@RequestParam(name="currentPage")Integer currentPage,@RequestParam(name="pageSize")Integer pageSize){
        R r = new R();
        r.setMsg("查询所有信息成功！");
        r.setCode(200);
        List<Resume> resumeList = new ArrayList<>();
        Resume resume = new Resume();
        Resume resume1 = new Resume();
        Resume resume2 = new Resume();
        resume.setResume_id(1);
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        String Re_birthday = "1991-01-01";
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(2);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
//        resume.getParams_son().setParam_Id(2);
//        resume.getParams_son().setParam_Name("本科");

        resume1.setResume_id(2);
        resume1.setRe_name("李四");
        resume1.setRe_sex("男");
        String Re_birthday1 = "1991-02-02";
        resume1.setRe_birthday(DateUtils.string2Date(Re_birthday1));
        resume1.setRe_education(0);
        resume1.setRe_tel("19899999999");
        resume1.setRe_status(0);
//        resume1.getParams_son().setParam_Id(0);
//        resume1.getParams_son().setParam_Name("初中");

        resume2.setResume_id(3);
        resume2.setRe_name("王二麻子");
        resume2.setRe_sex("男");
        String Re_birthday2 = "1991-03-03";
        resume2.setRe_birthday(DateUtils.string2Date(Re_birthday2));
        resume2.setRe_education(1);
        resume2.setRe_tel("19818181818");
        resume2.setRe_status(1);


        resumeList.add(resume);
        resumeList.add(resume1);
        resumeList.add(resume2);

        r.setData(resumeList);
        return r;
    }

    /**
     * 查看单个人才信息接口
     * @param resume_id
     * @return
     */
    @RequestMapping(value = "/showDetailedInfo",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查看单个人才信息接口",notes = "查找",httpMethod = "GET", response = Resume.class)
    @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showDetailedInfo(@RequestParam(name = "resume_id") Integer resume_id){

        R r = new R();
        String Re_birthday = "1991-01-01";
        //String emp_jointime = "2021-01-01";
        r.setMsg("查询成功！");
        r.setCode(200);
        Resume resume = new Resume();
        resume.setResume_id(resume_id);
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(1);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
//        resume.getParams_son().setParam_Id(2);
//        resume.getParams_son().setParam_Name("本科");
       // resume.getEmp().setEmp_jointime(DateUtils.string2Date(emp_jointime));
//        resume.getParams_son().setParam_Id(11);
//        resume.getParams_son().setParam_Name("汉族");
        resume.setRe_nation(11);
        resume.setRe_height(178.00);
        resume.setRe_weight(65.00);
        resume.setRe_native("四川泸州");
//        resume.getParams_son().setParam_Id(11);
//        resume.getParams_son().setParam_Name("汉族");
//        resume.getParams_son().setParam_Id(21);
//        resume.getParams_son().setParam_Name("本科");
        resume.setRe_applyjob(21);
        resume.setRe_expectedsalary(20000.00);
        resume.setRe_qq("88888888@qq.com");
        resume.setRe_educationbg("2007-2011年 昆明学院就读大学 计算机系 ");
        resume.setRe_skills("写程序，开车 ");
        resume.setRe_experience("2015-2016年7月，昆明礼盾经贸有限公司 任职网络营销");
        resume.setRe_selfassessment("对自己要求很严格，工作认真负责");
        resume.setRe_relatedremark("3天内我就可以到岗，需要公司提供食宿！");
        r.setData(resume);
        return r;
    }
    /**
     * 显示未查看简历
     * @param re_status
     * @return
     */
    @RequestMapping(value = "/notCheckResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示未查看简历",notes = "显示",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "re_status",value = "状态",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R notCheckResume(@RequestParam(name = "re_status") Integer re_status){
        R r = new R();
        r.setMsg("查询所有信息成功！");
        r.setCode(200);
        List<Resume> resumeList = new ArrayList<>();
        Resume resume = new Resume();
        Resume resume1 = new Resume();
        Resume resume2 = new Resume();
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        String Re_birthday = "1991-01-01";
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(2);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
        resume.setRe_applyjob(1);
        resume.setRe_expectedsalary(20000.00);

        resume1.setRe_name("李四");
        resume1.setRe_sex("男");
        String Re_birthday1 = "1991-02-02";
        resume1.setRe_birthday(DateUtils.string2Date(Re_birthday1));
        resume1.setRe_education(2);
        resume1.setRe_tel("19898989898");
        resume1.setRe_status(2);
        resume1.setRe_applyjob(1);
        resume1.setRe_expectedsalary(20000.00);

        resumeList.add(resume);
        resumeList.add(resume1);

        r.setData(resumeList);
        return r;
    }
    /**
     * 显示未录用简历
     * @param re_status
     * @return
     */
    @RequestMapping(value = "/notEmployResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示未录用简历",notes = "显示",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "re_status",value = "状态",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R notEmployResume(@RequestParam(name = "re_status") Integer re_status){
        R r = new R();
        r.setMsg("查询所有信息成功！");
        r.setCode(200);
        List<Resume> resumeList = new ArrayList<>();
        Resume resume = new Resume();
        Resume resume1 = new Resume();
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        String Re_birthday = "1991-01-01";
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(2);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
        resume.setRe_applyjob(1);
        resume.setRe_expectedsalary(20000.00);

        resume1.setRe_name("李四");
        resume1.setRe_sex("男");
        String Re_birthday1 = "1991-02-02";
        resume1.setRe_birthday(DateUtils.string2Date(Re_birthday1));
        resume1.setRe_education(2);
        resume1.setRe_tel("19898989898");
        resume1.setRe_status(2);
        resume1.setRe_applyjob(1);
        resume1.setRe_expectedsalary(20000.00);

        resumeList.add(resume);
        resumeList.add(resume1);

        r.setData(resumeList);
        return r;
    }
    /**
     * 显示已经录用简历
     * @param re_status
     * @return
     */
    @RequestMapping(value = "/alreadyEmployResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示已经录用简历",notes = "显示",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "re_status",value = "状态",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R alreadyEmployResume(@RequestParam(name = "re_status") Integer re_status){
        R r = new R();
        r.setMsg("查询所有信息成功！");
        r.setCode(200);
        List<Resume> resumeList = new ArrayList<>();
        Resume resume = new Resume();
        Resume resume1 = new Resume();
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        String Re_birthday = "1991-01-01";
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(2);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
        resume.setRe_applyjob(1);
        resume.setRe_expectedsalary(20000.00);

        resume1.setRe_name("李四");
        resume1.setRe_sex("男");
        String Re_birthday1 = "1991-02-02";
        resume1.setRe_birthday(DateUtils.string2Date(Re_birthday1));
        resume1.setRe_education(2);
        resume1.setRe_tel("19898989898");
        resume1.setRe_status(2);
        resume1.setRe_applyjob(1);
        resume1.setRe_expectedsalary(20000.00);

        resumeList.add(resume);
        resumeList.add(resume1);

        r.setData(resumeList);
        return r;
    }

    /**
     * 显示已经工作的简历
     * @param re_status
     * @return
     */
    @RequestMapping(value = "/alreadyWorkResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示已经工作的简历",notes = "显示",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "re_status",value = "状态",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R alreadyWorkResume(@RequestParam(name = "re_status") Integer re_status){
        R r = new R();
        r.setMsg("查询所有信息成功！");
        r.setCode(200);
        List<Resume> resumeList = new ArrayList<>();
        Resume resume = new Resume();
        Resume resume1 = new Resume();
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        String Re_birthday = "1991-01-01";
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(2);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
        resume.setRe_applyjob(1);
        resume.setRe_expectedsalary(20000.00);

        resume1.setRe_name("李四");
        resume1.setRe_sex("男");
        String Re_birthday1 = "1991-02-02";
        resume1.setRe_birthday(DateUtils.string2Date(Re_birthday1));
        resume1.setRe_education(2);
        resume1.setRe_tel("19898989898");
        resume1.setRe_status(2);
        resume1.setRe_applyjob(1);
        resume1.setRe_expectedsalary(20000.00);

        resumeList.add(resume);
        resumeList.add(resume1);

        r.setData(resumeList);
        return r;
    }
    /**
     * 显示未查看简历的具体信息
     * @param resume_id
     * @return
     */
    @RequestMapping(value = "/showNotCheckResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示未查看简历的具体信息",notes = "查找",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showNotCheckResume(Integer resume_id){
        R r = new R();
        String Re_birthday = "1991-01-01";
        //String emp_jointime = "2021-01-01";
        r.setMsg("查询成功！");
        r.setCode(200);
        Resume resume = new Resume();
        resume.setResume_id(resume_id);
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(1);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
        resume.setRe_nation(11);
        resume.setRe_height(178.00);
        resume.setRe_weight(65.00);
        resume.setRe_native("四川泸州");
        resume.setRe_applyjob(21);
        resume.setRe_expectedsalary(20000.00);
        resume.setRe_qq("88888888@qq.com");
        return r;
    }

    /**
     * 显示未录用简历的具体信息
     * @param resume_id
     * @return
     */
    @RequestMapping(value = "/showNotEmployResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示未录用简历的具体信息",notes = "查找",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showNotEmployResume(Integer resume_id){
        R r = new R();
        String Re_birthday = "1991-01-01";
        //String emp_jointime = "2021-01-01";
        r.setMsg("查询成功！");
        r.setCode(200);
        Resume resume = new Resume();
        resume.setResume_id(resume_id);
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(1);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
        resume.setRe_nation(11);
        resume.setRe_height(178.00);
        resume.setRe_weight(65.00);
        resume.setRe_native("四川泸州");
        resume.setRe_applyjob(21);
        resume.setRe_expectedsalary(20000.00);
        resume.setRe_qq("88888888@qq.com");
        return r;
    }

    /**
     * 显示已录用简历的具体信息
     * @param resume_id
     * @return
     */
    @RequestMapping(value = "/showAlreadyEmployResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示未录用简历的具体信息",notes = "查找",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showAlreadyEmployResume(Integer resume_id){
        R r = new R();
        String Re_birthday = "1991-01-01";
        //String emp_jointime = "2021-01-01";
        r.setMsg("查询成功！");
        r.setCode(200);
        Resume resume = new Resume();
        resume.setResume_id(resume_id);
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(1);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
        resume.setRe_nation(11);
        resume.setRe_height(178.00);
        resume.setRe_weight(65.00);
        resume.setRe_native("四川泸州");
        resume.setRe_applyjob(21);
        resume.setRe_expectedsalary(20000.00);
        resume.setRe_qq("88888888@qq.com");
        return r;
    }

    /**
     * 显示已工作简历的具体信息
     * @param resume_id
     * @return
     */
    @RequestMapping(value = "/showAlreadyWorkResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示未录用简历的具体信息",notes = "查找",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showAlreadyWorkResume(Integer resume_id){
        R r = new R();
        String Re_birthday = "1991-01-01";
        //String emp_jointime = "2021-01-01";
        r.setMsg("查询成功！");
        r.setCode(200);
        Resume resume = new Resume();
        resume.setResume_id(resume_id);
        resume.setRe_name("张三");
        resume.setRe_sex("男");
        resume.setRe_birthday(DateUtils.string2Date(Re_birthday));
        resume.setRe_education(1);
        resume.setRe_tel("19898989898");
        resume.setRe_status(2);
        resume.setRe_nation(11);
        resume.setRe_height(178.00);
        resume.setRe_weight(65.00);
        resume.setRe_native("四川泸州");
        resume.setRe_applyjob(21);
        resume.setRe_expectedsalary(20000.00);
        resume.setRe_qq("88888888@qq.com");
        return r;
    }


    /**
     * 办理入职
     * @param resume_id
     * @return
     */
    @RequestMapping(value = "/joinedTheStaff",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "员工入职",notes = "添加",httpMethod = "POST", response = R.class)
    @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
   public R joinedTheStaff(Integer resume_id){
        R r = new R();
        r.setCode(200);
        r.setMsg("办理入职成功！");
        return r;
   }

    /**
     * 查询员工所在部门下拉框的所有值
     * @param
     * @return
     */
    @RequestMapping(value = "/selectAllDept",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询员工所在部门下拉框的所有值",notes = "查询",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
   public R selectAllDept(){
       R r = new R();
       r.setCode(200);
       r.setMsg("查询员工所在部门下拉框值成功！");
       List<Params_Son> list = new ArrayList<>();
       Params_Son params_son1 = new Params_Son();
       Params_Son params_son2 = new Params_Son();
       Params_Son params_son3 = new Params_Son();
       params_son1.setParam_value("事业部");
       params_son2.setParam_value("人才部");
       params_son3.setParam_value("技术部");
       list.add(params_son1);
       list.add(params_son2);
       list.add(params_son3);
       r.setData(list);
       return  r;
   }

    /**
     * 查询职称下拉框的所有值
     * @param
     * @return
     */
    @RequestMapping(value = "/selectAllCompetent",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询员工所在部门下拉框的所有值",notes = "查询",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectAllCompetent (){
        R r = new R();
        r.setCode(200);
        r.setMsg("查询职称下拉框值成功！");
        List<Params_Son> list = new ArrayList<>();
        Params_Son params_son1 = new Params_Son();
        Params_Son params_son2 = new Params_Son();
        Params_Son params_son3 = new Params_Son();
        params_son1.setParam_value("总监");
        params_son2.setParam_value("经理");
        params_son3.setParam_value("主管");
        list.add(params_son1);
        list.add(params_son2);
        list.add(params_son3);
        r.setData(list);
        return  r;
    }

    /**
     * 查询职称下拉框的所有值
     * @param
     * @return
     */
    @RequestMapping(value = "/selectAllPost",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询应聘岗位下拉框值",notes = "查询",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectAllPost (){
        R r = new R();
        r.setCode(200);
        r.setMsg("查询应聘岗位下拉框值成功！");
        List<Params_Son> list = new ArrayList<>();
        Params_Son params_son1 = new Params_Son();
        Params_Son params_son2 = new Params_Son();
        Params_Son params_son3 = new Params_Son();
        params_son1.setParam_value("技术");
        params_son2.setParam_value("营销");
        params_son3.setParam_value("会计");
        list.add(params_son1);
        list.add(params_son2);
        list.add(params_son3);
        r.setData(list);
        return  r;
    }
}
